import React, { lazy } from 'react'
import { Navigate } from 'react-router-dom'

var Index = lazy(() => import('../views/Index'))
var Login = lazy(() => import('../views/login'))
var Tel = lazy(() => import('../views/Reg/Tel'))
var Code = lazy(() => import('../views/Reg/Code'))
var Password = lazy(() => import('../views/Reg/Password'))
var Details = lazy(() => import('../views/Details'))
var NotFount = lazy(() => import('../views/NotFound'))
var Address = lazy(() => import('../views/Address'))
var Set = lazy(() => import('../views/Set'))
var Addresslist = lazy(() => import('../views/Addresslist'))
var AddAddress = lazy(() => import('../views/AddAddress'))
var OrderConfirm = lazy(() => import('../views/OrderConfirm'))
var OrderSee = lazy(() => import('../views/OrderSee'))
var Search = lazy(() => import('../views/Search'))

var Home = lazy(() => import('../views/index/Home'))
var Classify = lazy(() => import('../views/index/Classify'))
var Shopcart = lazy(() => import('../views/index/Shopcart'))
var Mine = lazy(() => import('../views/index/Mine'))
var Brand = lazy(() => import('../views/index/Brand'))

export default  [
    {
        path: '/index',
        element: <Index />,
        meta:{title:"主页"},
        children: [
            {
                path: '/index/home',
                element: <Home />
            },
            {
                path: '/index/classify',
                element: <Classify />,
                meta:{title:"分类"},
            },
            {
                path: '/index/shopcart',
                element: <Shopcart />
            },
            {
                path: '/index/mine',
                element: <Mine />
            },
            {
                path: '/index',
                element: <Navigate to='/index/home' />
            },
            {
                path: '*',
                element: <NotFount />
            }
        ]
    },
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/reg',
        element: <Tel />
    },
    {
        path: '/code',
        element: <Code />
    },
    {
        path: '/password',
        element: <Password />
    },
    {
        path: '/details',
        element: <Details />
    },
    {
        path: '/address',
        element: <Address />
    },
    {
        path: '/set',
        element: <Set />
    },
    {
        path: '/addresslist',
        element: <Addresslist />
    },
    {
        path: '/addaddress',
        element: <AddAddress />
    },
    {
        path: '/OrderConfirm',
        element: <OrderConfirm />
    },
    {
        path: '/OrderSee',
        element: <OrderSee />
    },
    {
        path: '/search',
        element: <Search />
    },
    {
        path: '/brand',
        element: <Brand />
    },
    {
        path: '/',
        element: <Navigate to='/index' />
    },
    {
        path: '*',
        element: <NotFount />
    },

]